import com.yu.common.model.User;
import com.yu.common.service.UserService;
import com.yu.rpc.core.bootstrap.ConsumerBootStrap;
import com.yu.rpc.core.config.RpcConfig;
import com.yu.rpc.core.proxy.ServiceProxyFactory;
import com.yu.rpc.core.utils.ConfigUtils;

public class EasyConsumerExample {
    public static void main(String[] args) {
        ConsumerBootStrap.init();
        RpcConfig rpcConfig = ConfigUtils.loadConfig(RpcConfig.class, "rpc");
        UserService service;
        if (rpcConfig.isMock()) {
            service = ServiceProxyFactory.getMockProxy(UserService.class);
        } else {
            service = ServiceProxyFactory.getProxy(UserService.class);
        }
        System.out.println(service.getUser(new User("小明")).getName());
    }
}
